export const FormDialogMixin = {
  data () {
    return {
      visible: false,
    }
  },
  methods: {
    add (fks) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.add(fks)
      })
    },
    edit (id) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.edit(id)
      })
    },
    detail (id) {
      this.visible = true
      this.$nextTick(() => {
        this.$refs.form.detail(id)
      })
    },
    handleOk () {
      this.$refs.form.save()
    },
    handleCancel () {
      this.visible = false
    },
    refreshParent () {
      this.handleCancel()
      this.$emit('refreshParent')
    },
  }
}